/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package be.ua.ac.comp.projectGPT.auctionPolicies;

import be.ac.ua.comp.projectGPT.exceptions.InitializationException;

/**
 * Implementation for an auction policy on which the auction depends.
 * The auction will end after a certain amount of bidding rounds.
 */
public class BiddingRoundPolicy extends AuctionPolicy {
    
    int biddingRounds;
    int currentBiddingRound;

    public BiddingRoundPolicy(int biddingRounds) {
        this.biddingRounds = biddingRounds;

    }

    public boolean stop() {
        currentBiddingRound++;
        return(currentBiddingRound <= biddingRounds);
    }

    @Override
    public void start() throws InitializationException {
        if(!initialized) {
            throw new InitializationException(this.toString());
        }
        logger.info("Starting");
        currentBiddingRound = 1;
    }

}
